﻿using System.Web;
using TNPTN.Models;
using System.Globalization;

namespace TNPTN.Session
{
    /// <summary>
    /// Infomation
    /// </summary>
    public static class Info
    {
        #region propertise


        private const string SES_LANG_ID = "SES_LANG_ID";
        /// <summary>
        /// Language ID
        /// </summary>
        public static Enums.LanguageID LangID
        {
            get
            {
                if (HttpContext.Current.Session[SES_LANG_ID] != null)
                {
                    return (Enums.LanguageID)HttpContext.Current.Session[SES_LANG_ID];
                }
                return Enums.LanguageID.Cam;
            }
            set
            {
                HttpContext.Current.Session[SES_LANG_ID] = value;
            }
        }

        /// <summary>
        /// Current Culture Info
        /// </summary>
        public static CultureInfo CurrentCulture
        {
            get
            {
                CultureInfo ret = null;
                switch (Info.LangID)
                {
                    case Enums.LanguageID.Vietnamese:
                        ret = CultureInfo.CreateSpecificCulture("vi-VN");
                        break;
                    case Enums.LanguageID.English:
                        ret = CultureInfo.CreateSpecificCulture("en-US");
                        break;
                    default:
                        ret = CultureInfo.CreateSpecificCulture("ms-MY");
                        break;
                }
                return ret;
            }
        }

        #endregion
    }
}